<?php $data = rank_select(false, "DATE_FORMAT(RANK_PERIODE, '%Y-%m') BETWEEN DATE_FORMAT('$startPeriode','%Y-%m') AND DATE_FORMAT('$endPeriode','%Y-%m')", 
						"RANK_PERIODE". ($orderby? ",$orderby" : ""));?>
<?php $oldperiode = ""?>
<?php while ($row = mysql_fetch_assoc($data)):?>
<?php $periode = date("m", strtotime($row['RANK_PERIODE'])) . '-' . date("Y", strtotime($row['RANK_PERIODE']))?>

<?php if ($oldperiode != $periode):?>
<tr bgcolor="#CCCCCC">
	<td colspan="6"><strong><?php echo $periode ?></strong></td>
</tr>
<?php $oldperiode = $periode?>
<?php endif;?>

<?php $kary = mysql_fetch_assoc(kary_load($row['KODE_KARYAWAN']))?>
<tr <?php echo tag_zebra($z++);?> align="center" 
	onclick="detailView('<?php echo $row['KODE_KARYAWAN'] ?>', '<?php echo strtotime($row['RANK_PERIODE'])?>')"
	style="cursor:pointer">
    <td><?php echo $row['RANK_ID'] ?></th>
    <td><?php echo $kary['NAMA_KARYAWAN'] ?></td>
    <td><?php echo $row['RANK_RANGKING'] ?></td>
    <!-- <td><?php echo date("m", strtotime($row['RANK_PERIODE'])) . '-' . date("Y", strtotime($row['RANK_PERIODE'])) ?></td> -->
    <td><?php echo $row['RANK_POINT'] ?></td>
    <td>&nbsp;</td>
</tr>
<?php endwhile;?>